import Vue from 'vue'
import VueRouter from 'vue-router'
//后台分工路由
// import basis_router from './houtai/basis_router'
// import finance_router from './houtai/finance_router'
// import foods_router from './houtai/foods_router'
// import inventry_router from './houtai/inventry_router'
// import operate_router from './houtai/operate_router'
// import system_router from './houtai/system_router'
//前台分工路由
import ddgl_router from './houtai/ddgl_router'
import spgl_router from './houtai/spgl_router'
import quanxian_router from './houtai/quanxian_router'
import shouye_router from './houtai/shouye_router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import coupon_router from './houtai/coupon_router'

Vue.use(VueRouter)
const routes = [
 	{
 		path:'/login',
 		name:'login',
 		component:()=>import('@/views/Login'),
 		meta:{
 			require:false,
 			roles:[1]
 		}
 	},
 	{
 		path:'/',
 		redirect:'/login'
 	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	}
	,
	{
		path: '/register',
		name: 'Register',
		component: Register,
	},
 	{
 		path:'/index1',
 		name:'qiantaiIndex',
 		component:()=>import('@/views/houtai/index'),
 		children:[
 			...ddgl_router,
 			...spgl_router,
 			...quanxian_router,
			...shouye_router,
			...coupon_router,
			{
				path: '/index',
				name: 'Index',
				component: () => import( '../components/cb_shouye/cb_shouye.vue'),
				meta:{
					isLogin:true,
				}
			},
 			{
 				path:'/index1',
 				name:'spgl',
 				component:()=>import('../components/Product/J_ProductList'),
 				meta:{
 					require:true,
 					roles:[1]
 				}
 			}
 		],
 		meta:{
 			require:true,
 			roles:[1]
 		}
 	}
 	// {
 	// 	path:'/index2',
 	// 	name:'houtaiIndex',
 	// 	component:()=>import('@/views/houtai/index'),
 	// 	children:[
 	// 		...basis_router,
 	// 		...finance_router,
 	// 		...foods_router,
 	// 		...inventry_router,
 	// 		...operate_router,
 	// 		...system_router,
 	// 		{
 	// 			path:'/index2',
 	// 			name:'main',
 	// 			component:()=>import('@/views/houtai/Main'),
 	// 			meta:{
 	// 				require:true,
 	// 				roles:[2]
 	// 			}
 	// 		}
 	// 	],
 	// 	meta:{
 	// 		require:true,
 	// 		roles:[2]
 	// 	}
 	// }
]
//权限 1 员工 2 会计 3 普通管理员 4超级管理员
const router = new VueRouter({
  routes
})

export default router
